## Check that we successfully patch the PointerToRawData field in more than
## one debug directory entry.

# RUN: yaml2obj %s -o %t.in.exe

# RUN: llvm-readobj --coff-debug-directory %t.in.exe | FileCheck %s --check-prefixes=DEBUG-DIRS,DEBUG-DIRS-PRE
# RUN: llvm-readobj --sections %t.in.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE
# RUN: llvm-objcopy --remove-section .rdata %t.in.exe %t.out.exe
# RUN: llvm-readobj --coff-debug-directory %t.out.exe | FileCheck %s --check-prefixes=DEBUG-DIRS,DEBUG-DIRS-POST
# RUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-POST

# DEBUG-DIRS:               AddressOfRawData: 0x3038
# DEBUG-DIRS-PRE-NEXT:      PointerToRawData: 0x638
# DEBUG-DIRS-POST-NEXT:     PointerToRawData: 0x438

# DEBUG-DIRS:               AddressOfRawData: 0x3051
# DEBUG-DIRS-PRE-NEXT:      PointerToRawData: 0x651
# DEBUG-DIRS-POST-NEXT:     PointerToRawData: 0x451

# SECTIONS:           Name: .buildid
# SECTIONS-NEXT:      VirtualSize:
# SECTIONS-NEXT:      VirtualAddress:
# SECTIONS-NEXT:      RawDataSize:
# SECTIONS-PRE-NEXT:  PointerToRawData: 0x600
# SECTIONS-POST-NEXT: PointerToRawData: 0x400

--- !COFF
OptionalHeader:
  AddressOfEntryPoint: 4096
  ImageBase:       5368709120
  SectionAlignment: 4096
  FileAlignment:   512
  MajorOperatingSystemVersion: 6
  MinorOperatingSystemVersion: 0
  MajorImageVersion: 0
  MinorImageVersion: 0
  MajorSubsystemVersion: 6
  MinorSubsystemVersion: 0
  Subsystem:       IMAGE_SUBSYSTEM_WINDOWS_CUI
  DLLCharacteristics: [  ]
  SizeOfStackReserve: 1048576
  SizeOfStackCommit: 4096
  SizeOfHeapReserve: 1048576
  SizeOfHeapCommit: 4096
  Debug:
    RelativeVirtualAddress: 12288
    Size:            56
header:
  Machine:         IMAGE_FILE_MACHINE_AMD64
  Characteristics: [  ]
sections:
  - Name:            .text
    Characteristics: [  ]
    VirtualAddress:  4096
    VirtualSize:     1
    SectionData:     C3
  - Name:            .rdata
    Characteristics: [  ]
    VirtualAddress:  8192
    VirtualSize:     32
    SectionData:     FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000
  - Name:            .buildid
    Characteristics: [  ]
    VirtualAddress:  12288
    VirtualSize:     85
    SectionData:     0000000046C7A65E00000000020000001900000038300000380600000000000046C7A65E000000001400000004000000513000005106000052534453B3411F5F27A80D2A4C4C44205044422E010000000001000000
symbols:
...
